//
//  MoonGlobalTool.m
//  iMAME4all
//
//  Created by LT-LT on 14-4-2.
//
//

#import "MoonGlobalTool.h"

@implementation MoonGlobalTool

+(BOOL)fristChangeCoin
{
    NSUserDefaults *userDf=[NSUserDefaults standardUserDefaults];
    NSString *fristChange=[userDf valueForKey:@"fristChange"];
    if ([fristChange isEqualToString:@"YES"]) {
        return YES;
    }
    return NO;
}
+(NSInteger )CoinNumber
{
    NSUserDefaults *userDf=[NSUserDefaults standardUserDefaults];
    NSString *coinNum=[userDf valueForKey:@"coin"];
    if (!coinNum) {
        [userDf setObject:@"5" forKey:@"coin"];
        coinNum=[userDf valueForKey:@"coin"];
    }
    return [coinNum integerValue] ;
}
+(BOOL)savecoinNum:(int)coinum
{
    NSUserDefaults *userDf=[NSUserDefaults standardUserDefaults];
    NSString *constr=[NSString stringWithFormat:@"%d",coinum];
    [userDf setObject:constr forKey:@"coin"];
    [userDf synchronize];
    return YES;
}

+(NSDate *)dateFromString:(NSString *)dateString{

    dateString=  @"20:00:00";
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat: @"HH:mm:ss"];
    NSDate *destDate= [dateFormatter dateFromString:dateString];
    [dateFormatter release];
    return destDate;
}
@end
